package com.keba.basic.encrypt.config.properties;

import com.keba.basic.constant.Constants;
import com.keba.basic.encrypt.constants.SecurityMode;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import java.util.ArrayList;
import java.util.List;

/**
 * @author ls
 * @since 2023-07-21
 */
@Configuration
@ConfigurationProperties(prefix = SecurityProperties.PREFIX)
@Data
public class SecurityProperties {
    public static final String PREFIX = Constants.PROJECT_PREFIX + ".security";
    /**
     * 加密字符串转义方式
     * {@link SecurityMode}
     */
    private SecurityMode mode = SecurityMode.BASE64;

    /**
     * 是否启用
     */
    private boolean enable = true;

    /**
     * 加解密类型
     */
    private String type = "AES";

    /**
     * 加解密转义字符串编码
     */
    private String charset = "UTF-8";

    /**
     * 对称加解密秘钥
     */
    private String secret = "+6cuvzvyrFZpRG9pf3r7eQ==";

    /**
     * 加解密对象字段递归深度
     */
    private int maxDeep = 5;

    /**
     * 非对称加密私钥
     */
    private String privateKey;

    /**
     * 非对称加密公钥
     */
    private String publicKey;

    /**
     * 扫描加解密实体类的包范围
     */
    private List<String> classPackage = new ArrayList<>();
}
